using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using IGlobalist.Cms.Bll;
using IGlobalist.Cms.Model;
using IGlobalist.Cms.Common;


namespace IGlobalist.Cms.Admin
{
    public partial class MediaManagement : AdminBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            IList<ICmsClass> cList = ClassController.GetClassListByClassTypeID((short)CmsObjectType.ContentCategory);
            foreach (ICmsClass clazz in cList)
            {
                for (int i = 0; i < clazz.PropertyList.Count; i++)
                    if ((Convert.ToString(clazz.PropertyList[i].Name) == "Type") && (Convert.ToString(clazz.PropertyList[i].Value) == "Media"))
                    {
                        Session[SessionVariable.Clazz.CurrentID] = clazz.ID; 
                        break;
                    }
            }
            ucActionBar.ObjectTypeCurrent = CmsObjectType.ContentCategory;
            ucActionBarBottom.ObjectTypeCurrent = CmsObjectType.ContentCategory;

            ucCategoryTree.BindMedia();

            ucCategoryTree.TreeNodeClick += ucPhotoList.DoBindPhoto;
            ucCategoryTree.TreeNodeClick += HiddenInfo;
            ucCategoryTree.TreeNodeClick += ucPhotoList.DoShow;
            ucCategoryTree.TreeNodeClick += ucPhotoAddEdit.DoShow;
            ucCategoryTree.TreeNodeClick += ucPhotoAddEdit.DoEditRoot;
            ucCategoryTree.TreeNodeClick += ucActionBar.DoListEditClick;
            ucCategoryTree.TreeNodeClick += ucActionBarBottom.DoListEditClick;


            ucActionBar.NewButtonClick += ucPhotoAddEdit.DoNew;
            ucActionBar.NewButtonClick += ucPhotoList.DoHidden;
            ucActionBar.NewButtonClick += ucPhotoAddEdit.DoShow;
            ucActionBar.NewButtonClick += ucActionBarBottom.DoEditClick;
            ucActionBar.NewButtonClick += HiddenInfo;
            ucActionBarBottom.NewButtonClick += ucPhotoAddEdit.DoNew;
            ucActionBarBottom.NewButtonClick += ucPhotoList.DoHidden;
            ucActionBarBottom.NewButtonClick += ucPhotoAddEdit.DoShow;
            ucActionBarBottom.NewButtonClick += ucActionBar.DoEditClick;
            ucActionBarBottom.NewButtonClick +=HiddenInfo;


            ucActionBar.SaveButtonClick += ucPhotoAddEdit.DoSaveMedia;
            ucActionBar.SaveButtonClick += ucPhotoList.DoShow;
            ucActionBar.SaveButtonClick += ucPhotoAddEdit.DoHidden;
            ucActionBar.SaveButtonClick += ucCategoryTree.BindRefesh;
            ucActionBarBottom.SaveButtonClick += ucPhotoAddEdit.DoSaveMedia;
            ucActionBarBottom.SaveButtonClick += ucPhotoList.DoShow;
            ucActionBarBottom.SaveButtonClick += ucPhotoAddEdit.DoHidden;
            ucActionBarBottom.SaveButtonClick += ucCategoryTree.BindRefesh;
           
            ucPhotoList.EditPhoto += ucPhotoAddEdit.DoEdit;
            ucPhotoList.EditPhoto += ucPhotoList.DoHidden;
            ucPhotoList.EditPhoto += ucPhotoAddEdit.DoShow;

            ucActionBar.DeleteButtonClick += ucCategoryTree.DoDeleteCategory;
            ucActionBar.DeleteButtonClick += ucPhotoAddEdit.DoNew;
            ucActionBar.DeleteButtonClick += ucCategoryTree.BindRefesh;

            ucActionBarBottom.DeleteButtonClick += ucCategoryTree.DoDeleteCategory;
            ucActionBarBottom.DeleteButtonClick += ucPhotoAddEdit.DoNew;
            ucActionBarBottom.DeleteButtonClick += ucCategoryTree.BindRefesh;


        }
        public void HiddenInfo(object sender, EventArgs e)
        {
            pnlInfo.Visible = false;
        }
    }
}
